package cn.test;

public class OrderUp {

    public static void main(String[] args) {
        int[] arr = {8,9,3,7,15,6,2};
        OrderUp up = new OrderUp();
        up.test(arr);
        System.out.println(arr);


    }

    public void test(int[] arr){
        int i,j,note;
        for (i=1;i<arr.length;i++){
            note = arr[i];
            j = i-1;
            while (j>=0 && note<arr[j]){
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = note;
        }
    }

}
